﻿<Window x:Class="XmlStudio.Dialogs.SettingsDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        loc:Translate.Uid="SettingsDialog.WindowTitle"
        xmlns:System="clr-namespace:System;assembly=mscorlib"
        xmlns:settings="clr-namespace:XmlStudio.Settings"
        xmlns:CustomWPFColorPicker="clr-namespace:CustomWPFColorPicker"
        xmlns:userControls="clr-namespace:XmlStudio.Resources.UserControls" 
        xmlns:loc="clr-namespace:Tomers.WPF.Localization;assembly=Tomers.WPF.Localization" xmlns:Controls="clr-namespace:XmlStudio.Controls" Title="{loc:Translate 'Options'}"
        MinWidth="300"
        MinHeight="200"
        WindowStartupLocation="CenterOwner"
        ResizeMode="NoResize"
        x:Name="SettingsWindow"
        Style="{StaticResource XmlStudioDialogStyle}">
    <Window.Resources>
        <ObjectDataProvider MethodName="GetValues"
                        ObjectType="{x:Type System:Enum}"
                        x:Key="layoutAlgorithmTypes">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="settings:LayoutAlgorithm" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <DataTemplate x:Key="LanguageTemplate">
            <TextBlock Text="{Binding DisplayName}" />
        </DataTemplate>
    </Window.Resources>
    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" MinHeight="200" MinWidth="300" >
        <Border BorderBrush="Gray" BorderThickness="1" Margin="{StaticResource DialogBoxMargin}" Background="{StaticResource DialogBackgoundBrush}">
            <DockPanel>
                <TabControl DockPanel.Dock="Top" Margin="{StaticResource DialogBoxMargin}">
                    <TabItem loc:Translate.Uid="SettinsWindow.TabControl.GeneralTab" Header="{loc:Translate 'General'}">
                        <Grid  Margin="{StaticResource DialogBoxMargin}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="0" loc:Translate.Uid="SettingsDialog.Language" 
                                       Text="{loc:Translate 'Language:'}" />

                            <ComboBox Margin="{StaticResource TextBoxMargin}" Height="{StaticResource TextBoxHeight}" Grid.Column="1" Grid.Row="0" x:Name="LanguagesComboBox" 
                                      ItemsSource="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=Languages}"
                                      SelectedValue="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=Language}"
                                      ItemTemplate="{StaticResource LanguageTemplate}"/>
                        </Grid>
                    </TabItem>
                    <TabItem loc:Translate.Uid="SettingsWindow.TabControl.ColorsTab" Header="{loc:Translate 'Colors'}">
                        <Grid  Margin="{StaticResource DialogBoxMargin}" >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="0" loc:Translate.Uid="SettingsDialog.VertexDefaultFillBrush"
                           Text="{loc:Translate 'Default fill color:'}" />
                            <DockPanel Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="ForeColorPicker" CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush, UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="1" loc:Translate.Uid="SettingsDialog.VertexDefaultStrokeBrush"
                           Text="{loc:Translate 'Default stroke color:'}" />
                            <DockPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="StrokeColorPicker" CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush, UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="2" loc:Translate.Uid="SettingsDialog.HighlightedVertexBackgroundBrush"
                           Text="{loc:Translate 'HighlightedVertexBackgroundBrush:'}" />
                            <DockPanel Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="HighlightedVertexBackgroundBrushColorPicker" 
                                                                 CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedVertexBackgroundBrush,
                                                                                UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="3" loc:Translate.Uid="SettingsDialog.HighlightedVertexBorderBrush"
                           Text="{loc:Translate 'HighlightedVertexBorderBrush:'}" />
                            <DockPanel Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="HighlightedVertexBorderBrushColorPicker" 
                                                                 CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedVertexBorderBrush,
                                                                                UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="4" loc:Translate.Uid="SettingsDialog.HighlightedVertexForegroundBrush"
                           Text="{loc:Translate 'HighlightedVertexForegroundBrush:'}" />
                            <DockPanel Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="HighlightedVertexForegroundBrushColorPicker" 
                                                                 CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedVertexForegroundBrush,
                                                                                UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="5" loc:Translate.Uid="SettingsDialog.SelectedVertexBackgroundBrush"
                           Text="{loc:Translate 'SelectedVertexBackgroundBrush:'}" />
                            <DockPanel Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="SelectedVertexBackgroundBrushColorPicker" 
                                                                 CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SelectedVertexBackgroundBrush,
                                                                                UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="6" loc:Translate.Uid="SettingsDialog.SemiHighlightedSourceVertexBorderBrush"
                           Text="{loc:Translate 'SemiHighlightedSourceVertexBorderBrush:'}" />
                            <DockPanel Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="SemiHighlightedSourceVertexBorderBrushColorPicker" 
                                                                 CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedSourceVertexBorderBrush,
                                                                                UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="7" loc:Translate.Uid="SettingsDialog.SemiHighlightedSourceVertexBackgroundBrush"
                           Text="{loc:Translate 'SemiHighlightedSourceVertexBackgroundBrush:'}" />
                            <DockPanel Grid.Row="7" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="SemiHighlightedSourceVertexBackgroundBrushColorPicker" 
                                                                 CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedSourceVertexBackgroundBrush,
                                                                                UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="8" loc:Translate.Uid="SettingsDialog.SemiHighlightedTargetVertexBorderBrush"
                           Text="{loc:Translate 'SemiHighlightedTargetVertexBorderBrush:'}" />
                            <DockPanel Grid.Row="8" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="SemiHighlightedTargetVertexBorderBrushColorPicker" 
                                                                 CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedTargetVertexBorderBrush,
                                                                                UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="9" loc:Translate.Uid="SettingsDialog.SemiHighlightedTargetVertexBackgroundBrush"
                           Text="{loc:Translate 'SemiHighlightedTargetVertexBackgroundBrush:'}" />
                            <DockPanel Grid.Row="9" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="SemiHighlightedTargetVertexBackgroundBrushColorPicker" 
                                                                 CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedTargetVertexBackgroundBrush,
                                                                                UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="10" loc:Translate.Uid="SettingsDialog.HighlightedEdgeBrush"
                           Text="{loc:Translate 'HighlightedEdgeBrush:'}" />
                            <DockPanel Grid.Row="10" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="HighlightedEdgeBrushColorPicker" 
                                                                 CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedEdgeBrush,
                                                                                UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="11" loc:Translate.Uid="SettingsDialog.SemiHighlightedInEdgeBrush"
                           Text="{loc:Translate 'SemiHighlightedInEdgeBrush:'}" />
                            <DockPanel Grid.Row="11" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="SemiHighlightedInEdgeBrushColorPicker" 
                                                                 CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedInEdgeBrush,
                                                                                UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="12" loc:Translate.Uid="SettingsDialog.SemiHighlightedOutEdgeBrush"
                           Text="{loc:Translate 'SemiHighlightedOutEdgeBrush:'}" />
                            <DockPanel Grid.Row="12" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="9 0 0 0">
                                <Controls:ColorPickerControlView x:Name="SemiHighlightedOutEdgeBrushColorPicker" 
                                                                 CurrentColor="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedOutEdgeBrush,
                                                                                UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                            </DockPanel>
                        </Grid>
                    </TabItem>
                    <TabItem loc:Translate.Uid="SettingsDialog.TabControl.XmlTab" Header="{loc:Translate Xml}">
                        <Grid  Margin="{StaticResource DialogBoxMargin}" >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="{StaticResource GridRowHeight}" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="0" loc:Translate.Uid="SettingsDialog.DefaultLayoutAlgorithm" 
                                       Text="{loc:Translate 'Default Layout Algorithm Type:'}" />

                            <ComboBox Margin="{StaticResource TextBoxMargin}" Height="{StaticResource TextBoxHeight}" Grid.Column="1" Grid.Row="0" x:Name="DefaultLayoutAlgorithmComboBox" 
                                      ItemsSource="{Binding Source={StaticResource layoutAlgorithmTypes}}" MinWidth="80"
                                      SelectedValue="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=DefaultLayoutAlgorithmType, UpdateSourceTrigger=Explicit, Mode=TwoWay}" />

                            <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="1" loc:Translate.Uid="SettingsDialog.NumberOfChildNodesWhenAutomaticallyExpanding"
                                       Text="{loc:Translate 'Number of child nodes when XmlStudio prompts before the expansion:'}" />

                            <TextBox Margin="{StaticResource TextBoxMargin}" Height="{StaticResource TextBoxHeight}" MinWidth="80" Grid.Column="1" Grid.Row="1" x:Name="NumberOfChildrenTextBox"
                                     Text="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=NodeCountToExpand, UpdateSourceTrigger=Explicit, Mode=TwoWay}" />

                        </Grid>
                    </TabItem>
                </TabControl>
                <!-- Footer -->
                <Grid DockPanel.Dock="Bottom">
                    <userControls:OKCancelButtons OKClicked="OKClicked" Margin="7 0 7 7" />
                </Grid>
            </DockPanel>
        </Border>
    </ScrollViewer>
</Window>